from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate

from models import get_ds_model_client

client = get_ds_model_client()

messages = ChatPromptTemplate.from_messages(
    [SystemMessagePromptTemplate.from_template("你是人工智能助手"), HumanMessagePromptTemplate.from_template("{text}")])

parser = StrOutputParser()

chain = messages | client | parser

print(chain.invoke({"text": "你好，我是kenney"}))
print(chain.invoke({"text": "你好，我是谁?"}))

